package xyz.lwm.lazycat.jdbc.exec;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * mapped row data which in ResultSet to object
 *
 * @author lwm
 * @param <T>
 */
@FunctionalInterface
public interface RowMapper<T> {

    /**
     * don't call rs.next()
     * the first number is 1, increased...
     *
     * @param rowNum 1,2,3...
     * @return mapped object
     */
    @Nullable T mapRow(@NotNull ResultSet rs, int rowNum) throws SQLException;

}